#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int t;
	cin >> t;
	while (t--) {
		int n, k, q;
		cin >> n >> k >> q;
		vector<int> a(k), b(k);
		for (int i = 0; i < k; i++)
			cin >> a[i];
		for (int i = 0; i < k; i++)
			cin >> b[i];

		int pre_b = 0, pre_a = 0;
		vector<double> v;
		for (int i = 0; i < k; i++) {
			v.push_back(1.0 * (b[i] - pre_b) / (a[i] - pre_a));
			pre_a = a[i];
			pre_b = b[i];
		}

		while (q--) {
			int d;
			cin >> d;
			int idx = lower_bound(a.begin(), a.end(), d) - a.begin();
			cout << (int)(b[idx] + (d - a[idx])*v[idx]) << " ";
		}
		cout << endl;
	}
	return 0;
}
